<!DOCTYPE HTML>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>checkbox演示文档</title>
    <style>
        body {
            background-color: pink;
        }
    </style>
    <script>
        function validate() {
            if (document.f1.myCheckbox.checked === false) {
                alert("请同意协议之后再提交");
                return false
            } else
                return true
        }
    </script>
</head>
<body>
<form name="f1" method="get" action="" onsubmit=" validate();">
    <input type="checkbox" name="myCheckbox" id="check1"/>是否同意本协议?
    <input type="submit" name="submit" value="提交">
    <input type="reset" name="reset" value="重置">
</form>
</body>
</html>
